<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Beautiful Nanchang - Personal Page</title>
    <link rel="stylesheet" href="../公共css样式/重置基本样式类.css">
    <link rel="stylesheet" href="../公共css样式/公共类.css">
    <link rel="stylesheet" href="个人页面.css">
    <!-- 添加jQuery和jQuery UI库 -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script>
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
</head>
<body>
    <!-- Header -->
    <div class="header">
        <div class="wrapper">
            <div class="logo">
                <a href="../test index首页/index.html">
                    <img src="../images图片库/header/logo.png" alt="Nanchang">
                    <h1>Beautiful Nanchang</h1>
                </a>
            </div>
            <div class="nav">
                <ul>
                    <li><a href="../test index首页/index.html">Home</a></li>
                    <li><a href="../游玩页面/游玩.html">Tourist Attractions</a></li>
                    <li><a href="../历史文化页面/历史文化.html">History and Culture</a></li>
                </ul>
            </div>
            <!-- <div class="search">
                <input type="text" placeholder="Please enter">
                <a href="#">Search</a>
            </div> -->
            <div class="user">
                <a href="#" id="logout-link">Logout</a>
            </div>
        </div>
    </div>

    <!-- Personal Page Content -->
    <div class="personal-content">
        <div class="wrapper">
            <!-- User Information Display and Current User Information -->
            <div class="info-box">
                <div class="user-info">
                    <img src="#" alt="User Avatar" class="user-avatar">
                    <h2 id="username-display">Not Logged In</h2>
                    <h4>Welcome to your personal page!</h4>
                </div>

                <div class="section">
                    <h3>Current User Information</h3>
                    <div class="current-info">
                        <p>Nickname: <span id="current-username"></span></p>
                        <p>Phone: <span id="current-phone"></span></p>
                        <p>Email: <span id="current-email"></span></p>
                        <p>Gender: <span id="current-gender"></span></p>
                        <p>Birthday: <span id="current-birthday"></span></p>
                        <p>Zodiac Sign: <span id="current-zodiac"></span></p>
                        <p>Places to Visit: <span id="current-places"></span></p>
                        <p>Personal Signature: <span id="current-signature"></span></p>
                    </div>
                </div>
            </div>

            <!-- Modify User Information -->
            <div class="edit-box">
                <div class="section">
                    <h3>Modify User Information</h3>
                    <div class="edit-forms">
                        <!-- Left side for image submission -->
                        <div class="left-edit">
                            <form class="profile-form" enctype="multipart/form-data">
                                <label for="avatar">Avatar:</label>
                                <div class="file-upload-container">
                                    <input type="file" id="edit-avatar" name="avatar" accept="image/*" style="display: none;">
                                    <button type="button" id="file-upload-btn">Choose File</button>
                                    <span id="file-name">No file chosen</span>
                                </div>
                                <br>
                                <div class="avatar-preview">
                                    <img id="avatar-preview" src="#" alt="Avatar Preview" style="display: none;">
                                </div>
                                <button type="button" class="save-avatar-btn">Save Avatar</button>
                            </form>
                        </div>
                        <!-- Right side for other information submission -->
                        <div class="right-edit">
                            <form class="profile-form" enctype="multipart/form-data">
                                <label for="username">Nickname:</label>
                                <input type="text" id="edit-username" name="username" required>
                                <br>
                                <label for="phone">Phone:</label>
                                <input type="tel" id="edit-phone" name="phone" required>
                                <br>
                                <label for="email">Email:</label>
                                <input type="email" id="edit-email" name="email" required>
                                <br>
                                <label for="gender">Gender:</label>
                                <select id="edit-gender" name="gender">
                                    <option value="Male">Male</option>
                                    <option value="Female">Female</option>
                                </select>
                                <br>
                                <label for="birthday">Birthday:</label>
                                <input type="text" id="edit-birthday" name="birthday" placeholder="yyyy/mm/dd">
                                <br>
                                <label for="places">Places to Visit:</label>
                                <div id="places-container">
                                    <!-- Dynamic generation of place options -->
                                </div>
                                <br>
                                <label for="signature">Personal Signature:</label>
                                <input type="text" id="edit-signature" name="signature">
                                <br>
                                <button type="button" class="save-other-info-btn">Save Other Information</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <div class="footer">
        <p>&copy; 2025 Beautiful Nanchang. All rights reserved.</p>
    </div>

    <script src="个人页面.js"></script>
    <script>
        $(document).ready(function() {
            // Initialize jQuery UI Datepicker for the birthday field
            $("#edit-birthday").datepicker({
                dateFormat: "yy/mm/dd", // Set the date format to "yyyy/mm/dd"
                changeYear: true,        // Allow year selection
                changeMonth: true,       // Allow month selection
                yearRange: "1900:+0"     // Set the year range
            });

            // When the birthday input changes, automatically calculate the zodiac sign
            $("#edit-birthday").on("change", function() {
                const birthday = $(this).val();
                if (birthday) {
                    const zodiac = calculateZodiac(birthday);
                    $("#current-zodiac").text(zodiac);
                }
            });
        });

        function calculateZodiac(birthday) {
            if (!birthday) return '';
            const [year, month, day] = birthday.split('/').map(Number);
            const zodiacs = [
                { name: 'Capricorn', start: new Date(year, 0, 20), end: new Date(year, 0, 31) },
                { name: 'Aquarius', start: new Date(year, 0, 32), end: new Date(year, 1, 18) },
                { name: 'Pisces', start: new Date(year, 1, 19), end: new Date(year, 2, 20) },
                { name: 'Aries', start: new Date(year, 2, 21), end: new Date(year, 3, 19) },
                { name: 'Taurus', start: new Date(year, 3, 20), end: new Date(year, 4, 20) },
                { name: 'Gemini', start: new Date(year, 4, 21), end: new Date(year, 5, 20) },
                { name: 'Cancer', start: new Date(year, 5, 21), end: new Date(year, 6, 22) },
                { name: 'Leo', start: new Date(year, 6, 23), end: new Date(year, 7, 22) },
                { name: 'Virgo', start: new Date(year, 7, 23), end: new Date(year, 8, 22) },
                { name: 'Libra', start: new Date(year, 8, 23), end: new Date(year, 9, 22) },
                { name: 'Scorpio', start: new Date(year, 9, 23), end: new Date(year, 10, 22) },
                { name: 'Sagittarius', start: new Date(year, 10, 23), end: new Date(year, 11, 21) },
                { name: 'Capricorn', start: new Date(year, 11, 22), end: new Date(year, 11, 31) }
            ];

            const birthDate = new Date(year, month - 1, day);
            for (const zodiac of zodiacs) {
                if (birthDate >= zodiac.start && birthDate <= zodiac.end) {
                    return zodiac.name;
                }
            }
            return '';
        }
    </script>
</body>
</html>